package grapho;

import java.util.Arrays;

public class Aluno 
{
    private int rm;
    private int[] alunoRM;
    
    public Aluno()
    {
        this(-1, new int[]{});
    }
    
    public Aluno(int rm)
    {
        this(rm, new int[]{});
    }
    
    public Aluno(int rm, int[] alunoRM)
    {
        this.rm = rm;
        this.alunoRM = alunoRM;
    }
    
    public int getRm()
    {
        return rm;
    }
    
    public void setRm(int rm)
    {
        this.rm = rm;
    }
    
    public int[] getAlunoRms()
    {
        return alunoRM;
    }
    
    public void setAlunoRms(int[] alunoRM)
    {
        this.alunoRM = alunoRM;
    }
    
    @Override
    public boolean equals(Object object)
    {
        if(object instanceof Aluno)
        {
            Aluno student = (Aluno) object;
            
            if(student.getRm() == rm && Arrays.equals(student.getAlunoRms(), alunoRM))
            {
                return true;
            }
            else
            {
                return false;
            }
        }
        else
        {
            return false;
        }
    }

    @Override
    public int hashCode() 
    {
        int hash = 5;
        
        hash = 53 * hash + rm;
        hash = 53 * hash + Arrays.hashCode(alunoRM);
        
        return hash;
    }
    
    @Override
    public String toString()
    {
        String rm = String.valueOf(getRm());
        int needMore = 5 - rm.length();
        
        if(needMore > 0)
        {
            for(int i = 0; i < needMore; i++)
            {
                rm = "0" + rm;
             }
        }
        
        return rm;
    }
}
